# -*- coding: utf-8 -*-
from django.db import models


# Create your models here.


class Branch(models.Model):
    branch_name = models.CharField(max_length=50, verbose_name=u'分支名称')
    project = models.ForeignKey('Project', verbose_name=u'隶属项目')


class NickName(models.Model):
    nickname = models.CharField(max_length=50, null=True, verbose_name=u'用户昵称')


class User(models.Model):
    username = models.CharField(max_length=50, verbose_name=u'用户名')
    email = models.CharField(max_length=50, unique=True)
    nickname = models.ForeignKey(NickName, null=True, verbose_name=u'用户昵称')


class Project(models.Model):
    pro_name = models.CharField(max_length=50, null=True, verbose_name=u'项目名')
    dict = models.CharField(max_length=100, verbose_name=u'项目路径')
    note = models.CharField(max_length=100, null=True, verbose_name=u'项目说明')


class Log(models.Model):
    commit = models.CharField(primary_key=True, unique=True, max_length=50, verbose_name=u'版本号')
    author = models.ForeignKey(User, null=True, verbose_name=u'作者')
    datetime = models.DateTimeField(null=True, verbose_name=u'提交时间')
    files = models.IntegerField(null=True, verbose_name=u'被修改的文件数')
    add = models.IntegerField(null=True, verbose_name=u'增加的行数')
    remove = models.IntegerField(null=True, verbose_name=u'删除的行数')
    branch = models.ForeignKey(Branch, verbose_name=u'隶属分支')
